﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Sumc.Client.ModernUI.Helpers
{
    public class TextProcessor
    {
        private readonly StringBuilder builder;

        public TextProcessor()
        {
            this.builder = new StringBuilder();
        }

        public TextProcessor AppendLine(string text)
        {
            this.builder.AppendLine(text);
            return this;
        }

        public TextProcessor AppendLine(params string[] values)
        {
            var valuesLength = values.Length - 1;
            for (int i = 0; i < valuesLength; i++)
            {
                this.builder.Append(values[i]);
            }

            this.builder.AppendLine(values[values.Length]);
            return this;
        }

        public TextProcessor AppendParagrapthWithTitle(string title, IEnumerable<string> values)
        {
            var text = string.Join(Environment.NewLine, values);
            this.builder.AppendLine(text);
            return this;
        }

        public override string ToString()
        {
            return this.builder.ToString();
        }
    }
}
